package com.mycode.controller;

import com.mycode.view.BankEmpOper;
import com.mycode.view.RegAccountDialog;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * @author shkstart
 * @create 2021-01-22 12:30
 */
public class BankEmpOperController implements ActionListener {
    private BankEmpOper frame;

    public BankEmpOperController(BankEmpOper bankEmpOper) {
        this.frame = bankEmpOper;

    }

    @Override
    public void actionPerformed(ActionEvent e) {
        //使用事件对象判断触发此事件的具体按钮
        if (e.getSource().equals("开户")) {
            new RegAccountDialog(frame);
        } else if (e.getSource().equals("冻结用户")) {
            String input = JOptionPane.showInputDialog("请输入需要冻结的用户");
            JOptionPane.showMessageDialog(frame, "冻结成功");

        } else if (e.getSource().equals("解冻用户")) {
            String input = JOptionPane.showInputDialog("请输入需要解冻的用户");
            JOptionPane.showMessageDialog(frame, "解冻成功");
        } else if (e.getSource().equals("退出")) {
            if (JOptionPane.NO_OPTION == JOptionPane.showConfirmDialog(frame, "是否确认退出")) ;
            return;
        }
        frame.dispose();


    }
}

